import Vue from 'vue'
import App from './App.vue'
import router from './router'

import axios from 'axios'
import VueAxios from 'vue-axios'

import VueRouter from 'vue-router'


Vue.use(VueAxios, axios)

import 'lib-flexible/flexible'

import {
  Tabbar,
  TabbarItem,
  Search,
  Tab,
  Tabs,
  Swipe,
  SwipeItem,
  Lazyload,
  NavBar,
  Icon,
  Toast,
  Sidebar,
  SidebarItem,
  List,
  Cell,
  CellGroup,
  PullRefresh,
  Uploader,
  Empty,
  Form,
  Field,
  Button,
  Popup,
  Dialog
} from 'vant';



Vue
  .use(Tabbar)
  .use(TabbarItem)
  .use(Search)
  .use(Tab)
  .use(Tabs)
  .use(Swipe)
  .use(SwipeItem)
  .use(Lazyload)
  .use(NavBar)
  .use(Icon)
  .use(Toast)
  .use(Sidebar)
  .use(SidebarItem)
  .use(List)
  .use(Cell)
  .use(CellGroup)
  .use(PullRefresh)
  .use(Uploader)
  .use(Empty)
  .use(Form)
  .use(Field)
  .use(Button)
  .use(Popup)
  .use(Dialog)
  .use(Lazyload, {
    lazyComponent: true,
  })

//启动加载提示
Toast.loading({
  message: '加载中...',
  //禁止穿透点击
  forbidClick: true,
  loadingType: 'spinner',
  //不会自动关闭提示
  duration: 0
})



//点击相同路由报错的解决方法, 捕获错误
let originPush = VueRouter.prototype.push;

//重新VueRouter的原型的push方法
VueRouter.prototype.push = function (location) {
  //location: 目标路由的信息
  // 

  originPush.call(this, location, () => { }, (err) => {
    // 
  });
}


Vue.config.productionTip = false

new Vue({
  data: {
    //音频标签
    $audio: null,

    //音频链接
    audioSrc: ''
  },
  router,
  render: h => h(App)
}).$mount('#app')
